package cn.tedu.imop.basic.dao.repository.impl;

import cn.tedu.imop.basic.dao.mapper.TagLibraryMapper;
import cn.tedu.imop.basic.dao.repository.TagLibraryRepository;
import cn.tedu.imop.basic.entity.TagLibrary;
import cn.tedu.imop.common.context.PageContext;
import cn.tedu.imop.common.pojo.PageData;
import cn.tedu.imop.common.utils.PageInfoToPageDataConverter;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TagLibraryRepositoryImpl implements TagLibraryRepository {

    private TagLibraryMapper tagLibraryMapper;
    public TagLibraryRepositoryImpl(TagLibraryMapper tagLibraryMapper) {
        this.tagLibraryMapper = tagLibraryMapper;
    }
    @Override
    public PageData<TagLibrary> selectTagLibraryList(TagLibrary tagLibrary) {
        PageContext.startPage();
        List<TagLibrary> tagLibraries = tagLibraryMapper.selectList(tagLibrary);
        return PageInfoToPageDataConverter.convert(new PageInfo<>(tagLibraries));
    }
    @Override
    public int insertTagLibrary(TagLibrary tagLibrary) {
        int rows=tagLibraryMapper.insert(tagLibrary);
        return rows;
    }
}
